x86, shadow: Fix read-to-use race condition
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 12 Apr 2010 16:51:56 +0000 (17:51 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 12 Apr 2010 16:51:56 +0000 (17:51 +0100)
commit24488e9b291f63bbcd38583d4a3731bcf5a3612c
treeda7db6588a48e15692045c04ed5918b85cecd599
parent4cdb003c2d6b044ebdd981fe0240ed6a9eddbe47
x86, shadow: Fix read-to-use race condition

If OOS mode is enabled, after last possible resync, read the guest l1e
one last time.  If it's different than the original read, start over
again.

This fixes a race which can result in inconsistent in-sync shadow
tables, leading to corruption:

v1: take page fault, read gl1e from an out-of-sync PT.
v2: modify gl1e, lowering permissions
[v1,v3]: resync l1 which was just read.
v1: propagate change to l1 shadow using stale gl1e

Now we have an in-sync shadow with more permissions than the guest.

The resync can happen either as a result of a 3rd vcpu doing a cr3
update, or under certain conditions by v1 itself.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
xen/arch/x86/mm/shadow/multi.c